package net.projecteuler.prob;

public class Problem48 implements Runnable {

	@Override
	public void run() {
		
		long value = 0;
		for(int i = 1; i <= 1000; i++){
			value += tenthDigitOfPower(i, i);
		}
		
		System.out.println(value % 10000000000L);

	}
	
	private long tenthDigitOfPower(int base, int exponent){
		if(base < 1 || exponent < 0) return 0;
		if(base == 1 || exponent == 0) return 1;
		
		long result = 1;
		
		for(int i = 0; i < exponent; i++)
			result = (result * base) % 10000000000L;
		
		return result;
	}

}
